import { getOrderList } from '@/api/client/order'

const state = {
    orderlist: [],  
   
   
}

const mutations = {
    SET_ORDERLIST: (state, data) => {
        state.orderlist = data;
        
    }
}

const actions = {
    // 获取订单列表
    getOrderList({ commit }, info) {
        const { createdStart, createdEnd, status, contactPhone, contactPerson, pageNo, pageSize } = info 
        return new Promise((resolve, reject) => {
            getOrderList({ createdStart, createdEnd, status, contactPhone, contactPerson, pageNo, pageSize }).then(response => {  
                commit('SET_ORDERLIST', response) 
                resolve()
            }).catch(error => {
                reject(error)
            })
        })
    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}

